import org.junit.Test;

import java.util.Scanner;

public class helloword {
//    public static
public static void main(String[] args) {
    System.out.println("sdafhfhosa");
    int num = 23;
    System.out.println();
    System.out.println("helloword.main");


}

@Test
public void test1(){
    char ch1 = 'a';
    char ch2 = (char)(ch1+1);
    double d = 3.14;
    int num = (int)d;
    System.out.println(num);
}

@Test
public void test3(){
    int num1 = 3;
    int num2 = 5;
    int i = 0;
    i++;
}
@Test
public void test4(){
    int num1 = 3;
    int num2 = 5;
    System.out.println(num1 < 0 && num2 > num1++);

}

@Test
public void test5(){
    int s = 88;

    if (s >= 90 && s <= 100){
        System.out.println("优秀");
    } else if (s >= 80 && s <= 90){
        System.out.println("良好");
    } else if (s >=70 && s <= 80){
        System.out.println("一般");
    } else if (s >=60 && s <= 70){
        System.out.println("及格");
    } else if (s < 60){
        System.out.println("不及格");
    }


}

    @Test
    public void  test6(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入");
        int s = scanner.nextInt();

        //保卫操作,非法操作直接返回
        if (s < 0 || s > 100) {
            System.out.println("输入错误");
            return ;
        }

        if (s >= 90 && s <= 100){
            System.out.println("优秀");
        } else if (s >= 80 && s <= 90){
            System.out.println("良好");
        } else if (s >=70 && s <= 80){
            System.out.println("一般");
        } else if (s >=60 && s <= 70){
            System.out.println("及格");
        } else if (s >= 0 && s < 60){
            System.out.println("不及格");
        }

    }

    @Test
    public void test7(){
        int i = 1;
        int result = 0;
        while (i <= 5){
            System.out.println(i);
            result = result + i;
            System.out.println("你猜" + result);
            ++i;
        }


    }

    @Test
    public void test9(){
        for (int i = 1; i <= 5;i++){
            System.out.println(555);
        }
    }

    @Test
    public void test10(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入两个数");
        int num1 = scanner.nextInt();
        int num2 = scanner.nextInt();
        System.out.println("num1:" + num1);
        System.out.println("num2:" + num2);
        int a = num1;
        num1 = num2;
        num2 = a;
        System.out.println("互换数值");
        System.out.println("num1:" + num1);
        System.out.println("num2:" + num2);
    }

    @Test
    public void test11(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入单价:");
        System.out.println("输入数量:");
        System.out.println("顾客输入金额:");
        double charge = scanner.nextDouble();
        double numb = scanner.nextDouble();
        double money = scanner.nextDouble();
        System.out.println("输入单价:" + charge);
        System.out.println("输入数量:" + numb);
        System.out.println("顾客输入金额:" + money);
        double fei = charge * numb;
        double b = fei * 0.8;
        double charge1;
        if(fei < 500 && money < fei){
            System.out.println("错误信息");
            return;
        }
        if(fei > 500 && money < b){
            System.out.println("错误信息");
            return;
        }
        if(fei >= 500){
            fei = fei * 0.8;
            charge1 = money - fei;
            System.out.println("应收金额：" + fei);
            System.out.println("找零：" + charge1);
        } else{
            charge1 = money - fei;
            System.out.println("应收金额：" + fei);
            System.out.println("找零：" + charge1);
        }

    }

    @Test
    public void test12(){
        int i;
        int result = 0;
        for(i = 1;i <= 100;i++){
            result = result + i;
            System.out.println(result);
        }
        System.out.println(result);
    }

    @Test
    public void test13(){
        int i;
        int sum = 0;
        for(i = 1;i <= 100;i++ ){
            if(i % 7 == 0){
                sum = sum +1;
                System.out.println(i);
            }
        }
        System.out.println(sum);
    }
//例题：随机生成一个整数。1-100
//用户输入一个整数，程序给出与存储的数字是“大”或者“小”，知道用户猜到这个数字位置。
//如果中途用户希望程序退出，输入0可以退出。
//int num = 200;
//猜吧！
//300
//太大了
//猜吧！
//180
// 太小了
//猜吧！
//200
//恭喜你，猜对了
    @Test
    public void test14() {
        int i = (int) (Math.random() * 100 + 1);
        System.out.println(i);
        Scanner scanner = new Scanner(System.in);
        System.out.println("猜吧，输入一个整数");
        while (true) {
            int a = scanner.nextInt();
            if(a == 0){
                break;
            }
            if(a > i){
                System.out.println("大");
            }else if(a < i){
                System.out.println("小");
            }else {
                System.out.println("猜对了");
                break;
            }
        }
    }

    @Test
    public void test15(){
        int i;
        int b;
        for (i = 1;i <= 3;i++){
            for (b = 1;b <= 4;b++){
                System.out.print("*");
            }
            System.out.println();
        }
    }

    @Test
    public void test16(){
    int a;
    int b;
    for (a = 1;a <= 5;a++){
        for(b = 1;b <= a;b++){
            System.out.print("*");
        }
        System.out.println("");
    }
    }

    @Test
    public void test17(){
        int a;
        int b;
        for (a = 1;a <= 9;a++){
            for (b = 1;b <= a;b++){
                System.out.print((b) + "*" + (a) + "=" + (b * a) + "\t" );
            }
            System.out.println();
        }
    }

    @Test
    public void test18(){
        for (int a = 1;a <= 5;a++){
            for (int b = 1;b <= a;b++){
                System.out.print(b);
            }
            System.out.println();
        }
    }

    @Test
    public void test19(){
        for (int a = 1;a <= 6;a++){
            for (int b = 1;b <= 6 - a;b++) {
                System.out.print(" ");
            }
            for (int c = 1;c <= (2 * a - 1);c++){
                System.out.print("*");
            }
            System.out.println();
        }
    }

    @Test
    public void test20(){
        for (int a = 1;a <= 6;a++){
            for (int b = 1;b <= a - 1;b++){
                System.out.print(" ");
            }
            for (int c = 1;c <= 13 - 2 * a;c++) {
                System.out.print("*");
            }
            System.out.println();
        }

    }

    @Test
    public void test21(){
        int sum1 = 0;
        int sum2 = 0;
        for (int i = 1;i <= 100;i++){
            if (i % 2 == 0){
                sum2 = sum2 + i;
            } else {
                sum1 = sum1 +i;
            }
        }
        System.out.println("奇数和：" + sum1);
        System.out.println("偶数和：" + sum2);
    }

    @Test
    public void test22(){
        int count = 0;
        for (int i = 1;i <= 1000;i++){
            if (i % 5 == 0) {
                System.out.print(i + "\t");
                count++;
            }
            if (count % 3 ==0){
                System.out.println();
            }
        }
    }

    @Test
    public void test24(){
        int result = 1;
        for (int i = 1; i <= 9; i++){
            result = result * i;
            System.out.println(result);
        }
        System.out.println(result);
    }

    @Test       //使用循环打印100-200之间所有的素数（只能被1和自己整除的数叫素数）使用循环打印100-200之间所有的素数（只能被1和自己整除的数叫素数）
    public void test25(){
        for (int i = 100; i <= 200; i++){
            boolean issushu = true;
            for (int j = 2; j < i; j++){
                if (i % j == 0){
                    issushu = false;
                    break;
                    }
                }
            if (issushu == true){
                System.out.println(i);
            };
            }
    }

    @Test
    public void s11(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("月份");
        int month = scanner.nextInt();
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                System.out.println("31天");
                break;

            case 4:
            case 6:
            case 9:
            case 11:
                System.out.println("30天");
                break;
            default:
                System.out.println(" ");
                break;
            case 2:
                System.out.println("输入年份");
                int year = scanner.nextInt();
                if ((year % 4 ==0 && year % 100 != 0) || (year % 400 == 0)){
                    System.out.println("29天");
                }else{
                    System.out.println("28天");
                }
        }

    }


}
